<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>码蚁图册|用户登录</title>
    <script th:src="@{/webjars/jquery/3.4.1/jquery.js}"></script>
    <link th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.css}" rel="stylesheet"/>
    <link th:href="@{css/login.css}" rel="stylesheet"/>
</head>
<body>

<div class="container">
    <div class="col-md-6 offset-md-3" id="login">
        <div class="image"></div>
        <div id="error" class="text-center" style="color: lightgray"></div>
        <div class="text-center" style="color: lightgray" th:text="${error}" th:if="${not #strings.isEmpty(error)}"></div>
        <form method="post" action="/Index">
            <div class="form-group row">
                <div class="col-md-3 col-sm-4 col-4">
                    <label for="userName">userName</label>
                </div>
                <div class="col-md-9 col-sm-8 col-8">
                    <input type="number" class="form-control" name="userName" id="userName" placeholder="userName" oninput="if( this.value.length > 12)  this.value = this.value.slice(0,12)">
                </div>
            </div>
            <div class="form-group row">
                <div class="col-md-3 col-sm-4 col-4">
                    <label for="userPassword">userPassword</label>
                </div>
                <div class="col-md-9 col-sm-8 col-8">
                    <input type="password" class="form-control" name="userPassword" id="userPassword" placeholder="userPassword" maxlength="12">
                </div>
            </div>
            <div class="text-right"><a href="/register">No account? Register.</a></div>
            <div class="row">
                <button id="submit" type="submit" class="btn btn-default col-md-4 offset-md-4">Sign in</button>
            </div>
        </form>
    </div>
</div>
<div id="copy" class="text-center" th:fragment="foot" style="margin-top: 30px;">
    &copy;鄂ICP备19013259号
</div>
</body>
<script type="text/javascript">
    $(function(){
        $.get("/registerUserNumber",null,function(result){
            if(result!=""){
                $("#userName").val(result);
            }
        });
    });
</script>
</html>